<?php

/*
 * 基类文件 yatou.inc.php
 * yatou?baoyu!
 * Author wyouyu Time:2012-10-17
 */
class yatou
{
    var $tpl;
    
    var $user;
    
    var $db;
    
    var $get = array();
    
    var $post = array();
    
    public function __construct(&$get,&$post)
    {
        global $db,$user;
        $this->get = &$get;
        $this->post = &$post;
        $this->db = $db;
        $this->user = $user;
        $this->InitTemplate();
    }
    //引入smarty模板
    public function InitTemplate()
    {   
        global $settings;
        
        $this->tpl  = new Smarty();

        $this->tpl ->setTemplateDir(TemDire);

        $this->tpl ->setCompileDir(Cpath.'tpl/templates_c/');

        $this->tpl ->setConfigDir(Cpath.'tpl/configs/');

        $this->tpl ->setCacheDir(Cpath.'tpl/cache/');
        
        $this->tpl ->left_delimiter = '{baoyu ';
        
        $this->tpl ->right_delimiter =' baoyu}';

        $this->tpl ->assign('global',$settings);//获取配置文件中的配置
        
        $baseConfig = GetBaseConfig();//获取数据库里的配置文件
        
        foreach($baseConfig as $config)//这里得到的baseConfig 是一个二维数组,如果把这个二维数组渲染到模板需要用section,但是这里不要循环
        {
            $$config['varible'] = $config['value'];//
            $this->tpl->assign($config['varible'],$$config['varible']);
        }  
    }
    //错误/提示信息 显示页面
    function showmsg($msg,$jumptime,$jumpurl)
    {
        $this->tpl->assign('jumptime',$jumptime);
        $this->tpl->assign('jumpurl',$jumpurl);
        $this->tpl->assign('message',$msg);
        $this->tpl->display('message.tpl');
    }
}
?>
